<template>
    <div class="con-tab-left-top">
            <span :class="{active:index=== 1?true:false}" @click="toless">近期优惠</span>
            <span :class="{active:index=== 2?true:false}" @click="toactive">校区活动</span>
            <span :class="{active:index=== 3?true:false}" @click="tonews">热点新闻</span>
    </div>
</template>

<script>
    export default {
        name: "ConLeft",
        data(){
            return{
                index:1,
                less:[],
                active:[],
                news:[],
            }
        },
        created() {
            this.$axios.get('art/articlelist?sectionid=8&pageSize=1')
                .then(res=>{
                        this.less = res.data[0];
                        /* eslint-disable */

                        console.log(res);

                        /* eslint-enable */

                    }
                )
                // .catch((e) => {
                //     /* eslint-disable */
                //
                //     console.log(e);
                //
                //     /* eslint-enable */
                // });
            this.$axios.get('art/articlelist?sectionid=9&pageSize=5')
                .then(res=>{
                        this.active = res.data;
                        /* eslint-disable */

                        console.log(res);

                        /* eslint-enable */

                    }
                );
            this.$axios.get('art/articlelist?sectionid=10&pageSize=5')
                .then(res=>{
                        this.news = res.data;
                        /* eslint-disable */

                        console.log(res);

                        /* eslint-enable */

                    }
                );
        },
        methods:{
            toless(){
                this.$router.push({ path: "/less" });
                this.index = 1
            },
            toactive(){
                this.$router.push({ path: "/active" });
                this.index = 2
            },
            tonews(){
                this.$router.push({ path: "/news" });
                this.index = 3
            }
        }
    }
</script>

<style scoped>
 .active{
     border-bottom: 1px solid #2181f0;
     color:#2181f0;
     font-weight: bold;
 }
</style>